//
//  VoiceChatModule.h
//  eWeiXin
//
//  Created by chen wenhao on 14-6-24.
//  Copyright (c) 2014年 chen wenhao. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AudioToolbox/AudioToolbox.h"
#import <AVFoundation/AVFoundation.h>
#import <CoreAudio/CoreAudioTypes.h>

@interface VoiceChatModule : NSObject<AVAudioRecorderDelegate,AVAudioPlayerDelegate>
{
    AVAudioRecorder     *recorder;
    AVAudioPlayer       *player;
    NSString            *recordPath;
    NSString            *audioPath;
    NSTimer             *timer;
    
    BOOL isCancel;
}

+ (VoiceChatModule*)getInstance;

- (AVAudioRecorder *)getAVAudioRecorder;

- (int)startRecord:(NSString *)path;//-2，则为没有麦克权限，0为成功

- (void)stopRecord;

- (void)cancelRecord;

- (void)startPlayAudio:(NSString *)path;

- (void)stopPlayAudio;

- (double)getMICVolume;

- (float)getAudioLength:(NSString *)path;//返回单位是秒


@end
